home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4119 < prev    next >
Encoding:
Text File  |  1996-08-05  |  663 b   |  28 lines

  1. Path: unix1.sncc.lsu.edu!eenaya
  2. From: eenaya@unix1.sncc.lsu.edu (Pradeep Nayar)
  3. Newsgroups: comp.lang.c
  4. Subject: Re:strings
  5. Date: 1 Feb 1996 21:15:51 GMT
  6. Organization: Louisiana State University
  7. Message-ID: <4erai7$20uc@sp115.ocs.lsu.edu>
  8. NNTP-Posting-Host: unix1-t.sncc.lsu.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. As most of you guys pointed out, the decleration should have been
  12.  
  13. char str ;  /* instead of char *str */
  14.  
  15. so now,
  16. str = "hello world"[10] ; /* would be the character 'd' */
  17.  
  18. it is the same as -
  19.  
  20. char *str ;
  21. char ch ;
  22.  
  23. str = "hello world" ;
  24. ch = str[10] ;
  25.  
  26. Sorry about the mistake and thanks to all you guys for posting you replies.
  27. Pradeep Nayar
  28.